import React from 'react';

import Loadable from '@loadable/component';
import { CommonLayout, UserLayout } from 'layout';


const Home = Loadable(() => import('pages/Home'))
const About = Loadable(() => import('pages/About'))
const Login = Loadable(() => import('pages/Login'))

export interface RoutesConfig {
    path: string;
    component: React.ComponentType<any>;
    exact?: boolean;
    redirect?: string;
    children?: RoutesConfig []
}


const routes: RoutesConfig []= [
    {
        path: '/',
        component: Home,
        redirect: '/common/home'
    },
    {
        path: '/common',
        component: CommonLayout,
        children: [
            {
                path: '/common/home',
                component: Home,
            },
            {
                path: '/common/about',
                component: About,
            }
        ]
    },
    {
        path: '/user',
        component: UserLayout,
        children: [
            {
                path: '/user/login',
                component: Login
            }
        ]
    }
]

export default routes